-- crime_crackers
-- created by zhuangsl
-- 攻击概率对自身附加状态

return {
    apply = function(prop, baseValue)
        return prop[2];
    end,

    -- 攻击触发
    trigger = function(who, prop, arg)
        -- 概率触发
        local rand = DungeonM.getRandSeed("crime_crackers") % 1000;
        if (rand > prop[3]) then
            return;
        end

        -- 已有状态时不触发
        if CombatStatusM.checkStatus(who, prop[2]) then
            return;
        end

        -- 持续时间
        local round = prop[4];
        if round > 0 then
            round = CombatM.getRound() + round + 1;
        end

        -- 状态参数
        local condition = {
            ["end_round"] = round,
        };

        -- 附加状态
        CombatStatusM.applyStatus(who, prop[2], condition);

        -- 特技发动事件
        EventMgr.fire(event.SPECIAL_SKILL_TRIGGER, { propId = prop[1], key = prop[2], });
    end,

    record = function(target, prop, path)
        return false;
    end
};
